package com.gitee.zycra.future.job.common.annotation;


import com.gitee.zycra.future.job.common.enums.CommonEnum;
import com.gitee.zycra.future.job.common.validator.EnumValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author zycra
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = {EnumValidator.class})
public @interface EnumCheck {

    /**
     * 枚举类
     *
     * @return 枚举类
     */
    Class<? extends CommonEnum> value();

    /**
     * 是否必须
     *
     * @return 是否必须
     */
    boolean required() default true;

    /**
     * 校验失败信息
     *
     * @return 校验失败信息
     */
    String message() default "枚举校验失败";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
